import time

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

service = Service("chromedriver.exe")

driver =  webdriver.Chrome(service = service)

driver.get(r"file:D:\软件测试\A-第二部分\Login演示页面(2)\login.html")

driver.maximize_window()

ac = ActionChains(driver)

# #perform() ——执行链中的所有动作
# ac.click_and_hold(driver.find_element(By.XPATH,"//*[@id='box']/div[3]")).perform()
#
# #click_and_hold(on_element=None) ——点击鼠标左键，不松开
# ac.click_and_hold(on_element=None)
#
# #move_by_offset(xoffset, yoffset) ——鼠标从当前位置移动到某个坐标
# ac.move_by_offset(248,0).perform()

# drag_and_drop_by_offset(source, xoffset, yoffset) ——拖拽到某个坐标然后松开
dragger = driver.find_element(By.XPATH,"//*[@id='box']/div[3]")
ac.drag_and_drop_by_offset(dragger, 250, 0).perform()

